# main.py
from fastapi import FastAPI
from api.test import test_router
from api.library import library_router
from fastapi.middleware.cors import CORSMiddleware

app = FastAPI()

# 跨域配置
# 如果只想接收本地：allow_origins=["http://localhost:8080"]
app.add_middleware(
    CORSMiddleware,
    allow_origins=["*"],
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)
# 将api_app的所有路由添加到主app中
app.include_router(test_router)
